<!DOCTYPE html>
<html>
	<head>
		<title><?php echo $this->get('page_title') ?></title>

        <?php
        $apikeylama='AIzaSyC0JhNTyjMpdmUPMDYWIVuE57dUIHZH1SU'; //<--apikey lama
        $apikey    ='5L23FeL57KSutJ9jcd5X1QDzj8Y=';
        $clientid='gme-ptsmartfrentelecom';
        
        if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off'
            || $_SERVER['SERVER_PORT'] == 443) {
        
            $secure_connection = true;
            //$api="https://maps.googleapis.com/maps/api/js?key=$apikey&sensor=true";
            $api="https://maps.googleapis.com/maps/api/js?client=$clientid&sensor=true";
            $apiv2="https://maps.google.com/maps?file=api&amp;v=2&amp;client=$clientid&sensor=false";
        }else{
            
            $secure_connection = false;
            $api="http://maps.googleapis.com/maps/api/js?key=$apikeylama&sensor=true";
            $apiv2="https://maps.google.com/maps?file=api&amp;v=2&amp;key=$apikeylama&sensor=false";
            $apikey=$apikeylama;
        }
        ?>


		<?php if ( get_instance()->uri->segment(1) <>"login" && get_instance()->uri->segment(1) <>"mobile") { ?>
		<meta http-equiv="refresh" content="3600;url=<?php echo site_url('/logout/'.get_instance()->core->encode(get_instance()->uri->uri_string())) ?>" />
		<?php } ?>
		
		<?php
		$msg = get_instance()->session->flashdata('message');
        if( $msg <> "" && get_instance()->uri->segment(1) =="user_management" && get_instance()->uri->segment(2) =="change_password"){
		?>
			<meta http-equiv="refresh" content="3;url=<?php echo site_url('/logout/'.get_instance()->core->encode(get_instance()->uri->uri_string())) ?>" />
		<?php } ?>
		
		
		<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
		<!-- stylesheets -->
		<link rel="stylesheet" href="<?php echo base_url()?>file/shell/smooth/resources/css/reset.css" />
		<link rel="stylesheet" href="<?php echo base_url()?>file/shell/smooth/resources/css/style.css" media="screen" />
		<link rel="stylesheet" href="<?php echo base_url()?>file/shell/smooth/resources/css/style_full.css" />
		<link id="color" rel="stylesheet" href="<?php echo base_url()?>file/shell/smooth/resources/css/colors/red.css" />
		
		<link rel="stylesheet" href="<?php echo base_url()?>file/smooth/css/smoothness/jquery-ui-1.8.2.custom.css" />
		<link rel="stylesheet" href="<?php echo base_url()?>file/smooth/css/styles.css" />
		
		<!-- scripts (jquery) -->
		
		
		<!-- <script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script> -->
		<script src="<?php echo base_url('/assets/js/jquery-1.7.1.js') ?>"></script>	
		<!--[if IE]><script language="javascript" type="text/javascript" src="<?php echo base_url()?>file/shell/smooth/resources/scripts/excanvas.min.js"></script><![endif]-->
		<script src="<?php echo base_url()?>file/shell/smooth/resources/scripts/jquery-ui-1.8.custom.min.js"></script>
		<script src="<?php echo base_url()?>file/shell/smooth/resources/scripts/jquery.ui.selectmenu.js"></script>
		<script src="<?php echo base_url()?>file/shell/smooth/resources/scripts/jquery.flot.min.js"></script>
		<!-- <script src="<?php echo base_url()?>file/shell/smooth/resources/scripts/tiny_mce/tiny_mce.js"></script> -->
		<!-- <script src="<?php echo base_url()?>file/shell/smooth/resources/scripts/tiny_mce/jquery.tinymce.js"></script> -->
		<!-- scripts (custom) -->
		<script src="<?php echo base_url()?>file/shell/smooth/resources/scripts/smooth.js"></script>
		<script src="<?php echo base_url()?>file/shell/smooth/resources/scripts/smooth.menu.js"></script>
		<script src="<?php echo base_url()?>file/shell/smooth/resources/scripts/smooth.chart.js"></script>
		<script src="<?php echo base_url()?>file/shell/smooth/resources/scripts/smooth.table.js"></script>
		<script src="<?php echo base_url()?>file/shell/smooth/resources/scripts/smooth.form.js"></script>
		<script src="<?php echo base_url()?>file/shell/smooth/resources/scripts/smooth.dialog.js"></script>
		<script src="<?php echo base_url()?>file/shell/smooth/resources/scripts/smooth.autocomplete.js"></script>
		<script type="text/javascript">
			$(document).ready(function () {
				style_path = "<?php echo base_url()?>file/shell/smooth/resources/css/colors";
				$("#date-picker").datepicker();
				$("#box-tabs, #box-left-tabs").tabs();
				
				$('a span.normal ul li  ').hover(function(){
					alert('id');
					var timer = $(this).data('timer');
					if(timer) clearTimeout(timer);
					$(this).addClass('over');
				},function(){
					var li = $(this);
					li.data('timer', setTimeout(function(){ li.removeClass('over'); }, 500));
				});
			});
		</script>
		
		<script src="<?php echo base_url()?>file/smooth/js/jquery-1.4.2.min.js"></script>
		<script src="<?php echo base_url()?>file/smooth/js/jquery-ui-1.8.2.min.js"></script>
		<script src="<?php echo base_url()?>file/smooth/js/jquery-templ.js"></script>
		<script src="<?php echo base_url()?>file/smooth/js/jquery.validate.min.js"></script>
		<script src="<?php echo base_url()?>file/smooth/js/jquery.dataTables.min.js"></script>
		<script src="<?php echo base_url()?>file/smooth/js/region_cluster.js"></script>
		<script src="<?php echo base_url()?>file/shell/smooth/resources/scripts/jquery.datepick.js"></script><!-- TAMBAHAN -->
		<link rel="stylesheet" href="<?php echo base_url()?>file/smooth/css/smoothness/jquery.datepick.css" /><!-- TAMBAHAN -->
		
        <script src="<?php echo base_url()?>file/js/jquery/jquery.floatobject-1.0.js"></script>  

		<script>
			//activity signal
			//send immediately activity signal after login to prevent auto logout
			//alfin.akhret@gmail.com
			sendActivitySignal();

			$(document).ready(function(){
				setInterval(sendActivitySignal, 180000);
			});

			function sendActivitySignal()
			{
				$.ajax({
						type: 'post',
						url:'<?php echo site_url('/master/update_last_activity') ?>',
						data: {user_id: '<?php echo get_instance()->session->userdata("username"); ?>'}
				});
			}

		</script>				

<script>

/***********************************************
* Local Time script- ¬© Dynamic Drive (http://www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

var weekdaystxt=["Sun", "Mon", "Tues", "Wed", "Thurs", "Fri", "Sat"]

function showLocalTime(container, servermode, offsetMinutes, displayversion){
if (!document.getElementById || !document.getElementById(container)) return
this.container=document.getElementById(container)
this.displayversion=displayversion
var servertimestring=(servermode=="server-php")? '<?php print date("F d, Y H:i:s", time())?>' : (servermode=="server-ssi")? '<!--#config timefmt="%B %d, %Y %H:%M:%S"--><!--#echo var="DATE_LOCAL" -->' : '<%= Now() %>'
//alert (servertimestring);
this.localtime=this.serverdate=new Date(servertimestring)
this.localtime.setTime(this.serverdate.getTime()+offsetMinutes*60*1000) //add user offset to server time
this.updateTime()
this.updateContainer()
}

showLocalTime.prototype.updateTime=function(){
var thisobj=this
this.localtime.setSeconds(this.localtime.getSeconds()+1)
setTimeout(function(){thisobj.updateTime()}, 1000) //update time every second
}

showLocalTime.prototype.updateContainer=function(){
var thisobj=this
if (this.displayversion=="long")
this.container.innerHTML=this.localtime.toLocaleString()
else{
var hour=this.localtime.getHours()
var minutes=this.localtime.getMinutes()
var seconds=this.localtime.getSeconds()
var day=this.localtime.getUTCDate()
var month=this.localtime.getUTCMonth()+1
var year=this.localtime.getUTCFullYear()

var dayofweek=weekdaystxt[this.localtime.getDay()]
this.container.innerHTML="<br><p style='color: white;font-size:14px'>"+formatField(day)+"-"+ formatField(month) + "-"+ year +" "+formatField(hour)+":"+formatField(minutes)+":"+formatField(seconds)+"</p>"
}
setTimeout(function(){thisobj.updateContainer()}, 1000) //update container every second
}

function formatField(num, isHour){
if (typeof isHour!="undefined"){ //if this is the hour field
var hour=(num>12)? num-12 : num
return (hour==0)? 12 : hour
}
return (num<=9)? "0"+num : num//if this is minute or sec field
}

</script>
        
	</head>
	<body>
    

    
		<!-- header -->
		<div id="header">
		
			<!-- logo -->
			<div id="logo">
				<h1><a href="<?php echo base_url();?>" title="Smooth Admin"><img src="<?php echo base_url()?>file/images/logo_smartfren.png" alt="Smooth Admin" /></a></h1>
			</div>
			<!-- end logo -->
			<!-- user -->
			<ul id="user">
				<li class="first">Welcome <?php echo  get_instance()->mglobal->showdata('user_name','t_mtr_user',array('user_id'=>get_instance()->session->userdata('username')),'dblokal')?>
				<span>
					<?php
						if(get_instance()->session->userdata('territory_name')!="")
						{
							// echo "( Region: " . $this->session->userdata('region_name') . " | ".$this->session->userdata('territory_name')." )";
							echo '( <a href="'.site_url('/cluster').'">'. get_instance()->session->userdata('region_name') . ' | '.get_instance()->session->userdata("territory_name").' )';
						}
						else
						{
							echo '( <a href="'.site_url('/cluster').'">Choose Territory</a> )';
						}
					?>
				</span>
				</li>
                <li id="li" style="display: none;"><a onclick="tampildashboard()">See who online</a></li>               
				<li><a href="<?php echo site_url('/user_management/change_password') ?>">Change Password</a></li>
				<li><a href="<?php echo site_url('/logout/'.get_instance()->core->encode(get_instance()->uri->uri_string())) ?>">Logout</a></li>
			</ul>
			<!-- end user -->
			<div id="header-inner">
				<div id="home">
					<a href="<?php echo base_url()?>" title="Home"></a>
				</div>
                <div id="server-time" style="float: left;text-decoration: white;">
                </div>
                <script language="javascript">new showLocalTime("server-time", "server-php", 0, "short")</script>
				<!-- quick -->
				<ul id="quick">
					<?php
					$id = 0;
					$group = get_instance()->session->userdata("group");
					$menus = get_instance()->mmaster->getMenuSistem(0,$group);
					foreach($menus->result() as $r){
						$link = $r->alias == "" ? get_instance()->uri->uri_string()."#" : $r->alias;
						echo'<li>
							<a href="'.site_url($link).'" title="'. $r->name .'"><span class="normal">'. $r->name .'</span></a>';
								$smenu1 = get_instance()->mmaster->getMenuSistem($r->id,$group);
								if($smenu1->num_rows()>0){
									echo'<ul>';
									foreach($smenu1->result() as $s){
										$smenu2 = get_instance()->mmaster->getMenuSistem($s->id,$group);
										if($smenu2->num_rows()>0){
											if ($s->alias){
												echo'<li><a href="'.site_url($s->alias) .'" class="childs">'. $s->name .'</a>';
											}
											else
											{
												echo'<li><a href="#" class="childs">'. $s->name .'</a>';
											}
											echo'<ul>';
											foreach($smenu2->result() as $t){
												echo'<li><a href="'.site_url($t->alias).'">'. $t->name .'</a></li>';
												$smenu3 = get_instance()->mmaster->getMenuSistem($t->id);
											}
											echo'</ul>';
										}else{
											echo'<li><a href="'.site_url($s->alias).'">'. $s->name .'</a>';
										}
										echo'</li>';
									}
									echo'</ul>';
								}
						echo'</li>';
					}
					?>
				</ul>
				<!-- end quick -->
				<div class="corner tl"></div>
				<div class="corner tr"></div>
			</div>
		</div>
		<!-- end header -->
		<!-- content -->
		<div id="content">
			<!-- content / right -->
			<!-- table -->
            
            <?$data['api']=$api;?>
            <?$data['apiv2']=$apiv2;?>  
	
			<?php echo $this->content() ?>
			
			<!-- end table -->
			<!-- end content / right -->
		</div>
		<!-- end content -->
		<!-- footer -->
		<div id="footer">
			<!--p>Copyright &copy; 2013 PT. Smartfren Telecom Tbk. Powered by Nutech Integrasi. All Rights Reserved.</p> -->
			<? include "foot.php"; ?>
		</div>
		<!-- end footert -->



	</body>
</html>